<template lang="">
   <div class="nav-bg">
		<div id="nav">
			<router-link to="/admin">首页</router-link> |
			<router-link to="/admin/teacher">教师管理</router-link> |
            
            <el-dropdown>
                <a>
                    学生管理<i class="el-icon-arrow-down el-icon--right"></i>
                </a>
                <template  v-slot:dropdown>
                    <el-dropdown-menu>
                        <el-dropdown-item><router-link to="/admin/student/register">学生注册</router-link></el-dropdown-item>
                        <el-dropdown-item><router-link to="/admin/student/flies">学生档案</router-link></el-dropdown-item>
                    </el-dropdown-menu>
                </template>
            </el-dropdown>
            
            
            
            
            
      <!-- <router-link to="/teacher">教师管理</router-link> | -->
		</div>
		<div class="nav-login" @click="toLogin(admininfo)">
			<h3 v-if="admininfo==''||admininfo==null">请登录管理员系统</h3>
      <h3 v-else>{{admininfo.name}}</h3>
      <div class="login-logo">
      <img v-if="admininfo==''||admininfo==null" src="../../assets/logo.png"/>
      <img v-else src=""/>
      </div>
		</div>
	</div>

    <router-view/>
</template>

<script>
    export default{
        name:'Index',
        data(){
     return{
       admininfo:[],
       adminimg:''
     }
     
  },
  created () {
      this.admininfo=JSON.parse(localStorage.getItem("admintoken"))
      console.table(this.admininfo)
  },
        methods:{
            toLogin(admininfo){
                console.log('管理员登录')
                console.log(admininfo)
      if(admininfo==null){
        this.$router.replace("/admin/adminlogin");
      }else{
        localStorage.removeItem('admintoken')
        this.$router.go(0)
      }
            },
        }
    }
</script>

<style>
.nav-bg a{
    font-size:18px;
}
a{
    color:#303133;
    text-decoration: none;
}
</style>